package com.example.common.utils;


import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class LocalDateTimeUtils {

    public static final String DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DEFAULT_FORMAT);

    /**
     * 根据传入的天数，计算出天数后的日期最大时间
     *
     * @param day       天数
     * @return          开始时间，结束时间
     */
    public static String[] calcConditionDay (int day) {
        String[] times = new String[2];

        times[0] = FORMATTER.format(LocalDateTime.of(LocalDate.now(), LocalTime.MIN));
        times[1] = FORMATTER.format(LocalDateTime.of(LocalDate.now().plusDays(day), LocalTime.MAX));

        return times;
    }


}
